<?php

use think\Facade\Route;
use think\Facade\Env;

Route::domain(Env::get('app.bapi_url'), function () {
    header("Access-Control-Allow-Origin: *");
    header('Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS, DELETE, HEAD, PATCH');
    header("Access-Control-Allow-Headers: token,tokens,language, Origin, X-Requested-With, Content-Type, Accept");
    Route::miss(function () {
        $result = [
            'code' => 1,
            'msg'  => '接口错误',
            'time' => time(),
            'data' => [],
        ];
        return json($result);
        exit();
    });
    Route::group('User', function () {
        Route::post('login', '/login'); //登录
        Route::rule('info', '/info'); //登录
        Route::get('getdata', '/getdata'); //登录
        Route::get('getmonthdata', '/getmonthdata'); //登录
        Route::get('cate', '/cate'); //登录
        Route::get('goodlist', '/goodlist'); //登录
        Route::post('good_status', '/good_status'); //登录
        Route::post('goods_edit', '/goods_edit'); //登录
        Route::post('goodsspec_edit', '/goodsspec_edit'); //登录
        Route::post('uploads', '/uploads'); //登录
        Route::get('orderlist', '/orderlist'); //登录
        Route::get('orderdetail', '/orderdetail'); //登录
        Route::post('orderstatus', '/orderstatus'); //登录
        Route::get('getmoneylog', '/getmoneylog'); //登录
        Route::rule('withdraw', '/withdraw'); //登录
        Route::rule('bank', '/bank'); //登录
    })->prefix('User');
})->bind('bapi')->prefix('bapi');
